FROM node:22-bookworm-slim

WORKDIR /workspace
RUN apt-get update && apt-get install -y git curl wget \
    && rm -rf /var/lib/apt/lists/* \
    && corepack enable yarn \
    && corepack use yarn@4

ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

RUN mkdir -p /home/node/.cache && chown -R node:node /home/node/.cache
RUN mkdir -p /workspace/.yarn && chown -R node:node /workspace/.yarn
RUN chown -R node:node /workspace

USER node

EXPOSE 5173
